<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>13 - 多元素动画transition </title>
    <script src="../js/vue.min.js"></script>
    <script src="../js/axios.min.js"></script>
    <link rel="stylesheet" href="../css/animate.css">
    <style>
        p {
            width: 300px;
            height: 300px;
            background-color: red;
            margin: 30px auto;
        }


    </style>
</head>
<body>
<div id="app">
    <input type="text" v-model="name">

    <transition-group name="fade"
                      enter-active-class="animated fadeInLeft" leave-active-class="animated fadeOutRight"
    >
        <p v-for="(v,k) in arr2" :key="k">
            {{v}}
        </p>
    </transition-group>

</div>
<script>


    let vm = new Vue({
        el: "#app",
        data() {
            return {
                flag: false,
                arr: ['tom', 'jack', 'mike', 'alice', 'alex', 'mark'],
                name: ''
            }
        },
        computed: {
            arr2: function () {
                var temp = [];
                this.arr.forEach(val => {
                    if (val.includes(this.name)) {
                        temp.push(val);
                    }
                });
                return temp;
            }
        }


    });


</script>
</body>
</html>